home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / overview / dtscpluslibrary / headers / volume.h < prev    next >
Encoding:
Text File  |  2000-09-28  |  3.2 KB  |  103 lines

  1. /*
  2.     File:        Volume.h
  3.  
  4.     Contains:    TVolume is a simple volume based utility class (provides information about volumes)     
  5.                   TVolume.h contains the TVolume class definitions.
  6.  
  7.     Written by: Kent Sandvik    
  8.  
  9.     Copyright:    Copyright © 1999 by Apple Computer, Inc., All Rights Reserved.
  10.  
  11.                 You may incorporate this Apple sample source code into your program(s) without
  12.                 restriction. This Apple sample source code has been provided "AS IS" and the
  13.                 responsibility for its operation is yours. You are not permitted to redistribute
  14.                 this Apple sample source code as "Apple sample source code" after having made
  15.                 changes. If you're going to re-distribute the source, we require that you make
  16.                 it clear in the source that the code was descended from Apple sample source
  17.                 code, but that you've made changes.
  18.  
  19.     Change History (most recent first):
  20.                 8/18/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  21.                 
  22.  
  23. */
  24. // Declare label for this header file
  25. #ifndef _VOLUME_
  26. #define _VOLUME_
  27.  
  28. #ifndef _DTSCPLUSLIBRARY_
  29. #include "DTSCPlusLibrary.h"
  30. #endif
  31.  
  32. // TOOLBOX HEADER FILES
  33. #ifndef __FILES__
  34. #include <Files.h>
  35. #endif
  36.  
  37. #ifndef __TYPES__
  38. #include <Types.h>
  39. #endif
  40.  
  41. #ifndef __FOLDERS__
  42. #include <Folders.h>
  43. #endif
  44.  
  45. #ifndef __ERRORS__
  46. #include <Errors.h>
  47. #endif
  48.  
  49.  
  50. // _________________________________________________________________________________________________________ //
  51. //    TVolume Class Interface.
  52. class TVolume
  53. // TVolume will provide volume level information about mounted volumes.
  54. {
  55. public:
  56.     // CONSTRUCTORS AND DESTRUCTORS
  57.     TVolume();                                    // default constructor
  58.     TVolume(short refNum);                        // constructor that accepts a volume refnum
  59.     virtual~ TVolume();                            // default destructor
  60.  
  61.     // MAIN INTERFACE
  62.     virtual short GetBootVRefNum();                // find out the VRefNum of the boot volume
  63.     virtual long GetKFreeSpace();                // get amount of free space (Kb) on volume
  64.     virtual long GetFileCount();                // return amount of files on volume    
  65.     virtual long GetDirCount();                    // return amount of folders on volume    
  66.     virtual long GetCreationDate();                // return creation date of volume
  67.     virtual short GetDriverNumber();            // get actual driver number    
  68.     virtual Boolean GetName(Str255& name);        // get driver FSSpec
  69.     virtual short GetNumVolumes();                // get # of mounted volumes
  70.  
  71.     // ITERATORS
  72.     virtual void Reset();                        // get back to boot volume
  73.     virtual Boolean Last();                        // last volume?
  74.     virtual void Next();                        // iterate to next volume
  75.  
  76.     // INTERNAL FUNCTIONS
  77.     virtual Boolean GetHParamBlock();            // generate a lookup in a pre-defined param block
  78.  
  79.     // GET/SET FUNCTIONS
  80.     virtual void SetVRefNum(const short refNum);// set used VRefNum
  81.     virtual short GetVRefNum() const;            // get currently used VRefNum
  82.  
  83.     // FIELDS
  84. protected:
  85.     short fVRefNum;                                // the volume VRefNum
  86.     HParamBlockRec fPB;                            // paramBlock rec used everywhere
  87.     OSErr fError;                                // latest error
  88.     short fIndex;                                // volume index
  89.     Boolean fLast;                                // indicator if we have the last volume
  90. };
  91.  
  92.  
  93. #endif
  94.  
  95. // _________________________________________________________________________________________________________ //
  96.  
  97.  
  98. /*    Change History (most recent last):
  99.   No        Init.    Date        Comment
  100.   1            khs        1/5/93        New file
  101.   2            khs        1/7/93        Cleanup
  102. */
  103.